package internet;

import java.io.*;
import java.net.Socket;

public class ClientDemo3 {
    public static void main(String[] args) throws IOException {

        Socket s = new Socket("192.168.0.102", 10001);

        //封装文本文件数据
        BufferedReader br = new BufferedReader(new FileReader("funCode\\myNet.txt"));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));

        String line;
        while ((line = br.readLine()) != null) {
            bw.write(line);
            bw.newLine();
            bw.flush();
        }
       /* //自定义传数据结束
        bw.write("886");
        bw.newLine();
        bw.flush();*/
        s.shutdownOutput();
        // 接受反馈
        BufferedReader brS = new BufferedReader(new InputStreamReader(s.getInputStream()));

        String s1 = brS.readLine(); // 等待读数据
        System.out.println("Server:"+ s1);

        s.close();
        br.close();

    }
}
